const joi = require("joi");

const pay_type = joi.string().valid('微信', '支付宝').required();

const goodsList = joi.array().items(
  joi.object({
    goods_id: joi.number().required(),
    amount: joi.number().required(),
  })
).required();

const state = joi.number().integer().valid(1, 2).required();

const id = joi.number().integer().min(1).required();


const set_order_schema = {
  body: {
    pay_type,
    goodsList,
  }
}

const update_state_schema = {
  body: {
    state,
    id,
  }
}

module.exports = {
  set_order_schema,
  update_state_schema,
}